local skill = fk.CreateSkill {
  name = "kicking_while_down_skill",
}

skill:addEffect("cardskill", {
  prompt = "#kicking_while_down_skill",
  mod_target_filter = function(self, player, to_select, selected, card, distance_limited)
    return to_select ~= player and to_select:isWounded()
  end,
  target_filter = Util.CardTargetFilter,
  can_use = function(self, player, card)
    return not player:prohibitUse(card) and table.find(Fk:currentRoom().alive_players, function(p)
      return p:isWounded() and p ~= player end)
  end,
  on_use = function(self, room, use)
    if not use.tos or #use.tos == 0 then
      local player = use.from
      use.tos = {}
      for _, p in ipairs(Fk:currentRoom().alive_players) do
        if p:isWounded() and p ~= player and not player:isProhibited(p, use.card) then
          use:addTarget(p)
        end
      end
    end
  end,
  on_effect = function(self, room, effect)
    local from = effect.from
    local to = effect.to
    if to.dead then return end
      room:damage({
        from = from,
        to = to,
        card = effect.card,
        damage = 1,
        damageType = fk.NormalDamage,
        skillName = self.name,
      })
  end,
})

return skill

